home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-09-16 | 15.4 KB | 545 lines | [TEXT/CCL2] |
- {
- ////////////////////////////////////////////////////////////////////////////
- ////
- // OPEN SCRIPTING ARCHITECTURE: Client Interface
- ////////////////////////////////////////////////////////////////////////////
- ////
- // Copyright 1992 Apple Computer, Inc. All rights reserved.
- // Authors: Jens Alfke, William Cook, Donn Denman, and Warren Harris
- ////////////////////////////////////////////////////////////////////////////
- ////
- // This interface defines what it means to be a "scripting component."
- // Scripting components allow "scripts" to be loaded and executed. This
- // interface does not define the way in which a particular scripting
- // component's scripts are editing and debugged.
- ////////////////////////////////////////////////////////////////////////////
- ////
- }
-
- {$IFC UNDEFINED UsingIncludes}
- {$SETC UsingIncludes := 0}
- {$ENDC}
-
- {$IFC NOT UsingIncludes}
- UNIT OSA;
- INTERFACE
- {$ENDC}
-
- {$IFC UNDEFINED UsingOSA}
- {$SETC UsingOSA := 1}
-
- {$I+}
- {$SETC OSAIncludes := UsingIncludes}
- {$SETC UsingIncludes := 1}
- {$IFC UNDEFINED UsingAppleEvents}
- {$I $$Shell(PInterfaces)AppleEvents.p}
- {$ENDC}
- {$IFC UNDEFINED UsingComponents}
- {$I $$Shell(PInterfaces)Components.p}
- {$ENDC}
- {$SETC UsingIncludes := OSAIncludes}
-
- { Types and Constants }
- CONST
- kOSAComponentType = 'osa ';
- kOSAGenericScriptingComponentSubtype = 'scpt';
-
- TYPE
- OSAID = LONGINT;
- OSAError = ComponentResult;
-
- CONST
- kOSANullScript = 0;
-
- kOSAScriptResourceType = kOSAGenericScriptingComponentSubtype;
- typeOSAGenericStorage = kOSAScriptResourceType;
-
- { Error Codes }
- errOSACorruptData = -1702; { Same as errAECorruptData }
- errOSASystemError = -1750;
- errOSAInvalidID = -1751;
- errOSABadStorageType = -1752;
- errOSAScriptError = -1753;
- errOSABadSelector = -1754;
- errOSAInvalidAccess = -1755;
- errOSARecordingIsAlreadyOn = -30009;
-
- {
- ////////////////////////////////////////////////////////////////////////////
- ////
- // OSA Interface Descriptions
- ////////////////////////////////////////////////////////////////////////////
- ////
- // The OSA Interface is broken down into a required interface, and several
- // optional interfaces to support additional functionality. A given
- scripting
- // component may choose to support only some of the optional interfaces in
- // addition to the basic interface. The OSA Component Flags may be used to
-
- // query the Component Manager to find a scripting component with a
- particular
- // capability, or determine if a particular scripting component supports a
- // particular capability.
- ////////////////////////////////////////////////////////////////////////////
- ////
- }
-
- { OSA Component Flags }
- kOSASupportsCompiling = 2**0;
- kOSASupportsGetSource = 2**1;
- kOSASupportsAECoercion = 2**2;
- kOSASupportsAESending = 2**3;
- kOSASupportsRecording = 2**4;
- kOSASupportsWindowEditing = 2**5;
- kOSASupportsDialects = 2**6;
- kOSASupportsTinkering = 2**7;
-
- { Component Selectors }
- { Basic Scripting: }
- kOSASelectLoad = $0001;
- kOSASelectStore = $0002;
- kOSASelectExecute = $0003;
- kOSASelectDisplay = $0004;
- kOSASelectScriptError = $0005;
- kOSASelectDispose = $0006;
- kOSASelectSetScriptInfo = $0007;
- kOSASelectGetScriptInfo = $0008;
- kOSASelectSetActiveProc = $0009;
- kOSASelectGetActiveProc = $000A;
- { Compiling: }
- kOSASelectExactScriptingComponent = $0101;
- kOSASelectScriptingComponentName = $0102;
- kOSASelectCompile = $0103;
- kOSASelectCopyID = $0104;
- { GetSource: }
- kOSASelectGetSource = $0201;
- { AECoercion: }
- kOSASelectCoerceFromDesc = $0301;
- kOSASelectCoerceToDesc = $0302;
- { AESending: }
- kOSASelectSetSendProc = $0401;
- kOSASelectGetSendProc = $0402;
- kOSASelectSetCreateProc = $0403;
- kOSASelectGetCreateProc = $0404;
- { Recording: }
- kOSASelectStartRecording = $0501;
- kOSASelectStopRecording = $0502;
- { WindowEditing:
- kOSASelectOpenEditor = $0601;
- kOSASelectCloseEditor = $0602;
- { Dialects: }
- kOSASelectSetCurrentDialect = $0701;
- kOSASelectGetCurrentDialect = $0702;
- kOSASelectAvailableDialects = $0703;
- { Tinkering: }
- kOSASelectExecuteEvent = $0801;
- kOSASelectMakeContext = $0802;
-
- kOSASelectComponentSpecificStart = $1001;
- { scripting component specific selectors are added beginning with this
- value }
-
- {
- ////////////////////////////////////////////////////////////////////////////
- ////
- // OSA Basic Scripting Interface
- ////////////////////////////////////////////////////////////////////////////
- ////
- // Scripting components must at least support the Basic Scripting
- interface.
- ////////////////////////////////////////////////////////////////////////////
- ////
- }
-
- { Loading and Storing Scripts }
-
- FUNCTION
- OSALoad(scriptingComponent : ComponentInstance;
- scriptData : AEDesc;
- VAR resultingScriptID : OSAID)
- : OSAError;
- INLINE $2F3C, $0008, $0001, $7000, $A82A;
-
- FUNCTION
- OSAStore(scriptingComponent : ComponentInstance;
- scriptID : OSAID;
- desiredType : DescType;
- VAR resultingScriptData : AEDesc)
- : OSAError;
- INLINE $2F3C, $000C, $0002, $7000, $A82A;
-
- { Executing Scripts }
-
- FUNCTION
- OSAExecute(scriptingComponent : ComponentInstance;
- compiledScriptID : OSAID;
- contextID : OSAID;
- modeFlags : LONGINT;
- VAR resultingScriptValueID : OSAID)
- : OSAError;
- INLINE $2F3C, $0010, $0003, $7000, $A82A;
-
- { Displaying Results }
-
- FUNCTION
- OSADisplay(scriptingComponent : ComponentInstance;
- scriptValueID : OSAID;
- desiredType : DescType;
- modeFlags : LONGINT;
- VAR resultingText : AEDesc)
- : OSAError;
- INLINE $2F3C, $0010, $0004, $7000, $A82A;
-
- { Getting Error Information }
-
- FUNCTION
- OSAScriptError(scriptingComponent : ComponentInstance;
- selector : OSType;
- desiredType : DescType;
- VAR resultingErrorDescription : AEDesc)
- : OSAError;
- INLINE $2F3C, $000C, $0005, $7000, $A82A;
-
- CONST { OSAScriptError selectors: }
- kOSAErrorNumber = 'errn';
- kOSAErrorMessage = 'errs';
- kOSAErrorBriefMessage = 'errb';
- kOSAErrorApp = 'erap';
- kOSAErrorPartialResult = 'ptlr';
- kOSAErrorOffendingObject = 'erob';
- kOSAErrorRange = 'erng';
-
- { text ranges: }
- typeOSAErrorRange = 'erng';
- keySourceStart = 'srcs';
- keySourceEnd = 'srce';
-
- { Disposing Script IDs }
-
- FUNCTION
- OSADispose(scriptingComponent : ComponentInstance;
- scriptID : OSAID)
- : OSAError;
- INLINE $2F3C, $0004, $0006, $7000, $A82A;
-
- { Getting and Setting Script Information }
-
- FUNCTION
- OSASetScriptInfo(scriptingComponent : ComponentInstance;
- scriptID : OSAID;
- selector : OSType;
- value : LONGINT)
- : OSAError;
- INLINE $2F3C, $000C, $0007, $7000, $A82A;
-
- FUNCTION
- OSAGetScriptInfo(scriptingComponent : ComponentInstance;
- scriptID : OSAID;
- selector : OSType;
- VAR result : LONGINT)
- : OSAError;
- INLINE $2F3C, $000C, $0008, $7000, $A82A;
-
- CONST { selectors }
- kOSAScriptIsModified = 'modi';
- kOSAScriptIsBeingEdited = 'edit';
- kOSAScriptIsBeingRecorded = 'recd';
- kOSAScriptIsTypeCompiledScript = 'cscr';
- kOSAScriptIsTypeScriptValue = 'valu';
- kOSAScriptIsTypeScriptContext = 'cntx';
- kOSAScriptBestType = 'best';
-
- { Manipulating the ActiveProc }
-
- TYPE
- OSAActiveProcPtr = ProcPtr;
-
- FUNCTION
- OSASetActiveProc(scriptingComponent : ComponentInstance;
- activeProc : OSAActiveProcPtr;
- refCon : LONGINT)
- : OSAError;
- INLINE $2F3C, $0008, $0009, $7000, $A82A;
-
- FUNCTION
- OSAGetActiveProc(scriptingComponent : ComponentInstance;
- VAR activeProc : OSAActiveProcPtr;
- VAR refCon : LONGINT)
- : OSAError;
- INLINE $2F3C, $0008, $000A, $7000, $A82A;
-
- {
- ////////////////////////////////////////////////////////////////////////////
- ////
- // OSA Optional Compiling Interface
- ////////////////////////////////////////////////////////////////////////////
- ////
- // Scripting components that support the Compiling interface have the
- // kOSASupportsCompiling bit set in it's ComponentDescription.
- ////////////////////////////////////////////////////////////////////////////
- ////
- }
-
- FUNCTION
- OSAExactScriptingComponent(
- scriptingComponent : ComponentInstance;
- scriptID : OSAID;
- VAR exactScriptingComponent : ComponentInstance)
- : OSAError;
- INLINE $2F3C, $0008, $0101, $7000, $A82A;
-
- FUNCTION
- OSAScriptingComponentName(
- scriptingComponent : ComponentInstance;
- VAR resultingScriptingComponentName : AEDesc)
- : OSAError;
- INLINE $2F3C, $0004, $0102, $7000, $A82A;
-
- FUNCTION
- OSACompile(scriptingComponent : ComponentInstance;
- sourceData : AEDesc;
- modeFlags : LONGINT;
- VAR resultingCompiledScriptID : OSAID)
- : OSAError;
- INLINE $2F3C, $000C, $0103, $7000, $A82A;
-
- FUNCTION
- OSACopyID(scriptingComponent : ComponentInstance;
- fromID : OSAID;
- VAR toID : OSAID)
- : OSAError;
- INLINE $2F3C, $0008, $0104, $7000, $A82A;
-
- {
- ////////////////////////////////////////////////////////////////////////////
- ////
- // OSA Optional GetSource Interface
- ////////////////////////////////////////////////////////////////////////////
- ////
- // Scripting components that support the GetSource interface have the
- // kOSASupportsGetSource bit set in it's ComponentDescription.
- ////////////////////////////////////////////////////////////////////////////
- ////
- }
-
- FUNCTION
- OSAGetSource(scriptingComponent : ComponentInstance;
- scriptID : OSAID;
- desiredType : DescType;
- VAR resultingSourceData : AEDesc)
- : OSAError;
- INLINE $2F3C, $000C, $0201, $7000, $A82A;
-
- {
- ////////////////////////////////////////////////////////////////////////////
- ////
- // OSA Optional AECoercion Interface
- ////////////////////////////////////////////////////////////////////////////
- ////
- // Scripting components that support the AECoercion interface have the
- // kOSASupportsGetSource bit set in it's ComponentDescription.
- ////////////////////////////////////////////////////////////////////////////
- ////
- }
-
- FUNCTION
- OSACoerceFromDesc(scriptingComponent : ComponentInstance;
- scriptData : AEDesc;
- VAR resultingScriptValueID : OSAID)
- : OSAError;
- INLINE $2F3C, $0008, $0301, $7000, $A82A;
-
- FUNCTION
- OSACoerceToDesc(scriptingComponent : ComponentInstance;
- scriptValueID : OSAID;
- desiredType : DescType;
- VAR result : AEDesc)
- : OSAError;
- INLINE $2F3C, $000C, $0302, $7000, $A82A;
-
- {
- ////////////////////////////////////////////////////////////////////////////
- ////
- // OSA Optional AESending Interface
- ////////////////////////////////////////////////////////////////////////////
- ////
- // Scripting components that support the AESending interface have the
- // kOSASupportsAESending bit set in it's ComponentDescription.
- ////////////////////////////////////////////////////////////////////////////
- ////
- }
-
- TYPE
- AESendProcPtr = ProcPtr;
- AECreateAppleEventProcPtr = ProcPtr;
-
- { The first two proc pointers have the following interfaces
- taken from AppleEvents.p
-
- FUNCTION AECreateAppleEvent(theAEEventClass: AEEventClass;
- theAEEventID: AEEventID;
- target: AEAddressDesc;
- returnID: INTEGER;
- transactionID: LONGINT;
- VAR result: AppleEvent): OSErr;
-
- FUNCTION AESend(theAppleEvent: AppleEvent;
- VAR reply: AppleEvent;
- sendMode: AESendMode;
- sendPriority: AESendPriority;
- timeOutInTicks: LONGINT;
- idleProc: IdleProcPtr;
- filterProc: EventFilterProcPtr): OSErr;
-
- FUNCTION OSAActive(): OSErr;
-
- }
-
- FUNCTION
- OSASetSendProc(scriptingComponent : ComponentInstance;
- sendProc : AESendProcPtr;
- refCon : LONGINT)
- : OSAError;
- INLINE $2F3C, $0008, $0401, $7000, $A82A;
-
- FUNCTION
- OSAGetSendProc(scriptingComponent : ComponentInstance;
- VAR sendProc : AESendProcPtr;
- VAR refCon : LONGINT)
- : OSAError;
- INLINE $2F3C, $0008, $0402, $7000, $A82A;
-
- FUNCTION
- OSASetCreateProc(scriptSystem : ComponentInstance;
- createProc : AECreateAppleEventProcPtr;
- refCon : LONGINT)
- : OSAError;
- INLINE $2F3C, $0008, $0403, $7000, $A82A;
-
- FUNCTION
- OSAGetCreateProc(scriptSystem : ComponentInstance;
- VAR createProc : AECreateAppleEventProcPtr;
- VAR refCon : LONGINT)
- : OSAError;
- INLINE $2F3C, $0008, $0404, $7000, $A82A;
-
- {
- ////////////////////////////////////////////////////////////////////////////
- ////
- // OSA Optional Recording Interface
- ////////////////////////////////////////////////////////////////////////////
- ////
- // Scripting components that support the Recording interface have the
- // kOSASupportsRecording bit set in it's ComponentDescription.
- ////////////////////////////////////////////////////////////////////////////
- ////
- }
-
- FUNCTION
- OSAStartRecording(scriptingComponent : ComponentInstance;
- VAR compiledScriptToModifyID : OSAID)
- : OSAError;
- INLINE $2F3C, $0004, $0501, $7000, $A82A;
-
- FUNCTION
- OSAStopRecording(scriptingComponent : ComponentInstance;
- compiledScriptID : OSAID)
- : OSAError;
- INLINE $2F3C, $0004, $0502, $7000, $A82A;
-
- {
- ////////////////////////////////////////////////////////////////////////////
- ////
- // OSA Optional WindowEditing Interface
- ////////////////////////////////////////////////////////////////////////////
- ////
- // Scripting components that support the WindowEditing interface have the
- // kOSASupportsWindowEditing bit set in it's ComponentDescription.
- ////////////////////////////////////////////////////////////////////////////
- ////
- }
-
- FUNCTION
- OSAOpenEditor(scriptingComponent : ComponentInstance;
- VAR compiledScriptToModifyID : OSAID)
- : OSAError;
- INLINE $2F3C, $0004, $0601, $7000, $A82A;
-
- FUNCTION
- OSACloseEditor(scriptingComponent : ComponentInstance;
- compiledScriptID : OSAID)
- : OSAError;
- INLINE $2F3C, $0004, $0602, $7000, $A82A;
-
- {
- ////////////////////////////////////////////////////////////////////////////
- ////
- // OSA Optional Dialects Interface
- ////////////////////////////////////////////////////////////////////////////
- ////
- // Scripting components that support the Dialects interface have the
- // kOSASupportsDialects bit set in it's ComponentDescription.
- ////////////////////////////////////////////////////////////////////////////
- ////
- }
-
- FUNCTION
- OSASetCurrentDialect(scriptingComponent : ComponentInstance;
- dialectCode : INTEGER)
- : OSAError;
- INLINE $2F3C, $0002, $0701, $7000, $A82A;
-
- FUNCTION
- OSAGetCurrentDialect(scriptingComponent : ComponentInstance;
- VAR resultingDialectCode : INTEGER)
- : OSAError;
- INLINE $2F3C, $0004, $0702, $7000, $A82A;
-
- FUNCTION
- OSAAvailableDialects(scriptingComponent : ComponentInstance;
- VAR resultingDialectInfoList : AEDesc)
- : OSAError;
- INLINE $2F3C, $0004, $0703, $7000, $A82A;
-
- CONST
- typeOSADialectInfo = 'difo';
- keyOSADialectName = 'dnam';
- keyOSADialectCode = 'dcod';
-
- {
- ////////////////////////////////////////////////////////////////////////////
- ////
- // OSA Optional Tinkering Interface
- ////////////////////////////////////////////////////////////////////////////
- ////
- // Scripting components that support the Tinkering interface have the
- // kOSASupportsTinkering bit set in it's ComponentDescription.
- ////////////////////////////////////////////////////////////////////////////
- ////
- }
-
- FUNCTION
- OSAExecuteEvent(scriptingComponent : ComponentInstance;
- theAppleEvent : AppleEvent;
- contextID : OSAID;
- defaultHandler : EventHandlerProcPtr;
- modeFlags : LONGINT;
- VAR reply : AppleEvent;
- refCon : LONGINT)
- : OSAError;
- INLINE $2F3C, $0018, $0801, $7000, $A82A;
-
- FUNCTION
- OSAMakeContext(scriptingComponent : ComponentInstance;
- contextName : StringPtr;
- parentContext : OSAID;
- VAR resultingContextID : OSAID)
- : OSAError;
- INLINE $2F3C, $000C, $0802, $7000, $A82A;
-
- {$ENDC} { UsingOSA }
-
- {$IFC NOT UsingIncludes}
- END.
- {$ENDC}
-